← Back
Editing: gr_abort_query_on_plugin_error.test
################################################################################ # This test proves that no query can be executed when the plugin is active but # in an error state. # # The test induces such a state by causing a recovery failure on server 2. # Not being able to recover due to an invalid recovery user, the server stays in # an error state where no transactions can be executed. # # Test: # 0. The test requires two servers: M1 and M2. # 1. Bootstrap start a GROUP on M1, create table t1. Start GR on M2. Restart # GR on M2 inducing failure on recovery on M2 by setting invalid recovery # user. Keep retry count to 1. # 2. Recovery should fail and then M2 goes to ERROR. # 3. Expect ER_OPTION_PREVENTS_STATEMENT on DML execution because M2 is still in # super_read_only mode. # 4. STOP GR on M2. Set it to CORRECT recovery_user. START GR and re-execute # DML. # 5. Assert check that M1 and M2 have the same data and gtid_executed. # 6. Cleanup. # # For the test about recovery connection errors go to: # group_replication_recovery_connection_options.test ################################################################################ --let $group_replication_group_name= a1e87f30-b156-11e4-ab27-0800200c9a66 --source ../inc/have_group_replication_plugin.inc --let $rpl_skip_group_replication_start= 1 --source ../inc/group_replication.inc --echo ####################### --echo # Start a 2 server group --connection server1 --echo server1 --source ../inc/start_and_bootstrap_group_replication.inc CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY , b INT); --connection server2 --echo server2 --source include/start_group_replication.inc --echo --echo ##################################################################### --echo # Restart group replication on server 2 inducing a failure on recovery --source include/stop_group_replication.inc set session sql_log_bin=0; call mtr.add_suppression("There was an error when connecting to the donor*"); call mtr.add_suppression("For details please check performance_schema.replication_connection_status table and error log messages of Slave I/O for channel group_replication_recovery."); call mtr.add_suppression("Maximum number of retries when*"); call mtr.add_suppression("Fatal error during the Recovery process of Group Replication.*"); call mtr.add_suppression("Transaction cannot be executed while Group Replication is OFFLINE.*"); call mtr.add_suppression("Run function 'before_commit' in plugin 'group_replication' failed"); call mtr.add_suppression("The member is leaving a group without being on one"); call mtr.add_suppression("The member is already leaving or joining a group."); call mtr.add_suppression("Error leaving the group"); call mtr.add_suppression("Skipping leave operation: concurrent attempt to leave the group is on-going."); set session sql_log_bin=1; --disable_warnings CHANGE MASTER TO MASTER_USER='dummy_user' FOR CHANNEL 'group_replication_recovery'; --enable_warnings # Reduce the retry count to try only once. SET @debug_save_retries= @@GLOBAL.group_replication_recovery_retry_count; --eval SET GLOBAL group_replication_recovery_retry_count= 1 --echo --echo ########################################################## --echo # Recovery should fail and the server should become ERROR --let $group_replication_start_member_state= ERROR --source include/start_group_replication.inc --echo --echo ################################################################### --echo # When we try to execute a transaction on the server, it should fail as --echo # the server is running in the super-read-only mode --error ER_OPTION_PREVENTS_STATEMENT INSERT INTO test.t1 (b) VALUES (1); --echo --echo ########################################## --echo # Solve the issue and re-execute the query --source include/stop_group_replication.inc --disable_warnings CHANGE MASTER TO MASTER_USER='root' FOR CHANNEL 'group_replication_recovery'; --enable_warnings --source include/start_group_replication.inc INSERT INTO test.t1 (b) VALUES (1); --source include/rpl_sync.inc --echo --echo ####################################################################### --echo # Assert that server1 and server2 have the same data and GTID_EXECUTED. --connection server1 --echo server1 --let $assert_text= 'There is a value 1 in table t1 on server1' --let $assert_cond= [SELECT COUNT(*) AS count FROM t1, count, 1] = 1 --source include/assert.inc --connection server2 --echo server2 --let $assert_text= 'There is a value 1 in table t1 on server2' --let $assert_cond= [SELECT COUNT(*) AS count FROM t1, count, 1] = 1 --source include/assert.inc --connection server1 --echo server1 --let $server1_gtid_executed= `SELECT @@GLOBAL.GTID_EXECUTED` --connection server2 --echo server2 --let $server2_gtid_executed= `SELECT @@GLOBAL.GTID_EXECUTED` --let $assert_text= 'server1 and server2 GTID_EXECUTED must be equal' --let $assert_cond= "$server1_gtid_executed" = "$server2_gtid_executed" --source include/assert.inc --echo --echo ######### --echo # Cleanup SET @@GLOBAL.group_replication_recovery_retry_count= @debug_save_retries; DROP TABLE test.t1; --source ../inc/group_replication_end.inc
Save File
Cancel